package com.qf.listener;

import com.qf.stu;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "test-consumer-group-8",
    topic = "test-topic8",selectorExpression = "test-tag8",
    consumeMode = ConsumeMode.CONCURRENTLY,
    messageModel = MessageModel.CLUSTERING)
//消费者监听  ： 监听消息队列中是否有消息
public class ConsumerListener implements RocketMQListener<stu> {



    //如果有消息触发当前方法获取消息中的body
    @Override
    public void onMessage(stu msg) {
        //使用body进行业务处理
        System.out.println(msg);
        System.out.println(1);

    }
}